package com.example.mine_platform.config;


import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpHeaders;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

//@Component
//@Slf4j
//public class CorsInterceptor implements HandlerInterceptor {
//
//    @Override
//    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
//        String origin  = request.getHeader(HttpHeaders.ORIGIN);
//        if (origin != null) {
//            response.setHeader("Access-Control-Allow-Origin", "*");
//            // response.setHeader("Access-Control-Allow-Credentials", "true");
//            response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT, HEAD");
//            response.setHeader("Access-Control-Allow-Headers", "Content-Type, Token");
//            response.setHeader("Access-Control-Max-Age", "3600");
//        }
//        return true;
//    }
//}
